using System;
using System.Collections.Generic;
using System.Text;

using System.Data;
using System.Data.Common;
using Husb.Data;
using Husb.DataUtil;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Caching;

using CentralOffice.MyTable.Data;

using ViewEmailTable = CentralOffice.MyTable.Data.EmailDataSet.View_EmailDataTable;
using ViewEmailRow = CentralOffice.MyTable.Data.EmailDataSet.View_EmailRow;
namespace CentralOffice.MyTable.DataAccess
{
    public class ViewEmailAdapter : DataAccessAdapter<MyTable.Data.EmailDataSet, ViewEmailTable, ViewEmailRow>
    {
        public ViewEmailAdapter()
        {
            this.TableName = "View_Email";
            DeleteStoredProc = "ViewEmail_DeleteViewEmail";

            GetAllStoredProc = "ViewEmail_SelectViewEmailAll";
            InsertStoredProc = "ViewEmail_InsertViewEmail";
            UpdateStoredProc = "ViewEmail_UpdateViewEmail";
            FindStoredProc = "ViewEmail_SelectViewEmailDynamic";
            GetByIdStoredProc = "ViewEmail_SelectViewEmail";
            GetPagedStoredProc = "ViewEmail_SelectViewEmailPaged";
            GetRowCountStoredProc = "ViewEmail_SelectViewEmailRowCount";
        }

        protected override void PopulateInsertParameters(Database db, DbCommand cmd)
        {
            db.AddInParameter(cmd, "Id", DbType.Guid, "Id", DataRowVersion.Current);
            db.AddInParameter(cmd, "ToIdList", DbType.String, "ToId", DataRowVersion.Current);
            db.AddInParameter(cmd, "ReadFlag", DbType.String, "ReadFlag", DataRowVersion.Current);
            db.AddInParameter(cmd, "DeleteFlag", DbType.String, "DeleteFlag", DataRowVersion.Current);
            db.AddInParameter(cmd, "BoxId", DbType.String, "BoxId", DataRowVersion.Current);
            db.AddInParameter(cmd, "BodyId", DbType.String, "BodyId", DataRowVersion.Current);
            db.AddInParameter(cmd, "FromId", DbType.String, "FromId", DataRowVersion.Current);
            db.AddInParameter(cmd, "ToId", DbType.String, "ToId", DataRowVersion.Current);
            db.AddInParameter(cmd, "CopyToId", DbType.String, "CopyToId", DataRowVersion.Current);
            db.AddInParameter(cmd, "SecretToId", DbType.String, "SecretToId", DataRowVersion.Current);
            db.AddInParameter(cmd, "Subject", DbType.String, "Subject", DataRowVersion.Current);
            db.AddInParameter(cmd, "Content", DbType.String, "Content", DataRowVersion.Current);
            db.AddInParameter(cmd, "SendTime", DbType.DateTime, "SendTime", DataRowVersion.Current);
            db.AddInParameter(cmd, "AttachmentId", DbType.String, "AttachmentId", DataRowVersion.Current);
            db.AddInParameter(cmd, "AttachmentName", DbType.String, "AttachmentName", DataRowVersion.Current);
            db.AddInParameter(cmd, "SendFlag", DbType.String, "SendFlag", DataRowVersion.Current);
            db.AddInParameter(cmd, "SmsRemind", DbType.String, "SmsRemind", DataRowVersion.Current);
            db.AddInParameter(cmd, "Importants", DbType.String, "Important", DataRowVersion.Current);
            db.AddInParameter(cmd, "Size", DbType.Decimal, "Size", DataRowVersion.Current);
            db.AddInParameter(cmd, "FromWebMail", DbType.String, "FromWebMail", DataRowVersion.Current);
            db.AddInParameter(cmd, "ToWebMail", DbType.String, "ToWebMail", DataRowVersion.Current);
            db.AddInParameter(cmd, "FromName", DbType.String, "FromName", DataRowVersion.Current);
            db.AddInParameter(cmd, "ToName", DbType.String, "ToName", DataRowVersion.Current);
        }
    }
}
